package com.feng.springboot01.dao;

import com.feng.springboot01.pojo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.*;
@Repository
public class DepartmentDao {

    //模拟数据库中数据
    private static Map<Integer, Department> departments=null;
    static{
        departments=new HashMap<>();
        departments.put(0,new Department(0,"营销部"));
        departments.put(1,new Department(1,"市场部"));
        departments.put(2,new Department(2,"开发部"));
        departments.put(3,new Department(3,"研发部"));
        departments.put(4,new Department(4,"后勤部"));
        departments.put(5,new Department(5,"厨房部"));
    }

    //返回所有部门信息
    public Collection<Department> getAllDepartment(){
        return departments.values();
    }

    public Department getDepartmentById(int id){
        return departments.get(id);
    }

}
